package com.woniu.serviceorder.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class RedisConfig {
    private String potocol="redis://";
    @Value("${spring.data.redis.host}")
    private  String redisHost;

    @Value("${spring.data.redis.port}")
    private  String redisPort;

    @Bean("redissonBootYaml")
    public RedissonClient redissonClient(){
        Config config=new Config();
        config.useSingleServer().setAddress(potocol+redisHost+":"+redisPort).setPassword("rui123456").setDatabase(0);
        return Redisson.create(config);
    }
}
